package com.atguigu.day13.teacher.in4;

import org.junit.Test;

abstract class Dog {
    public abstract void eat();
    public void sleep() {
        System.out.println("小狗爱睡觉");
    }
}

public class DogTest {
    @Test
    public void test01() {
        //向上转型
        Dog dog = new Dog() {
            @Override
            public void eat() {
                System.out.println("小狗爱吃骨头");
            }
            public void lookHome() {
                System.out.println("小狗爱看家");
            }
        };
        dog.eat();
        dog.sleep();
        //todo 不能使用 子类新增(独有)的lookHome()
       // dog.lookHome();
    }
}
